1. Field of the Invention
The present invention relates to an IC card, particularly to an IC card in which an application program used for executing various functions for using the IC card, as well as a test program used for executing tests (product inspections) on the IC card are stored.
2. Description of the Related Art
FIG. 1 is a block diagram of the configuration of a conventional IC card. In an IC card 10, a system ROM 3 and an application ROM 4 are connected to a CPU 1 through a bus 2. FIG. 2 is a flowchart which shows the configuration of the programs respectively stored in the system ROM 3 serving as a second read only memory and the application ROM 4 serving as a first read only memory. As shown in FIG. 2, for example, a test program 31 which is used by the maker for performing functional tests of the products during production of IC cards is stored in the system ROM 3, and an application program 41, which is actually used by the user for executing various functions, is stored in the application ROM 4. In the system ROM 3 is also stored a branch routine 32 which decides which program is to be executed from among the test program 31 and the application program 41 and which branches into one of these programs. In FIG. 1, EEPROM 5 in which variable data is stored, RAM 6 in which data is temporarily stored and an input-output circuit 7 for performing input and output of data between the circuit 7 and external devices are further connected to the bus 2. In addition, terminal P1 is a positive source input terminal, terminal P2 is a power source grounding terminal, terminal P3 is a reset signal terminal for inputting a reset signal used for initializing the CPU 1, terminal P4 is a clock terminal for inputting a clock signal, and terminal P5 is an I/O terminal.
In such an IC card, when a reset signal is input from the reset signal terminal P3, the CPU 1 reads the execute start address of the branch routine 32 which has been previously stored at a given address in the system ROM 3 and starts the execution of the branch routine 32 from the execute start address. In the branch routine 32, when a command to execute the test program 31 is input to the I/O terminal P5 from an external device, the CPU 1 starts the test program 31 without any other operations. The test program 31 can access any desired address for performing product tests (inspections); i.e., the CPU 1 can access each address in accordance with the test program 31, whereby product tests can be conducted. On the other hand, when no command to execute the test program 31 is input, the execute start address of the application program 41 which has been previously stored at a given address in the application ROM 4 is read, and execution of the application program 41 is started from the execute start address.
Conventional IC cards have the above-described configuration in which, when a command to execute the test program is received in the branch routine, the test program is executed without any other operations. As described above, the test program is a program used for functional tests (product tests) on a card and has the function of accessing any desired address in memory in the card. It is therefore necessary to impart a high degree of security for access to the test program, i.e., the execution thereof, in order to prevent the test program from being used for unauthorized reading, copying or breaking into other programs stored in an IC card and for changing the contents thereof. However, conventional IC cards are not provided with a means for regulating the access to the test program or the execution of the same.